//
//  OrderListCell.m
//  ShangHaiTuJI
//
//  Created by xiaoxiangtuji on 2017/9/27.
//  Copyright © 2017年 xiaoxiangtuji. All rights reserved.
//

#import "OrderListCell.h"

@implementation OrderListCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}

-(instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        _statusBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        [_statusBtn setTitleColor:COLOR_HEX(0xF9D025) forState:UIControlStateNormal];
        _statusBtn.titleLabel.font = [UIFont systemFontOfSize:14.0f];
        [self.contentView addSubview:_statusBtn];
        [_statusBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-12));
            make.top.equalTo(self.contentView.mas_top).offset(scaleTopAndBottom(13));
            make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(61), scaleTopAndBottom(13)));
            
        }];
        UILabel *orderNumberLable = [[UILabel alloc] init];
        orderNumberLable.text = @"订单编号:123123213123";
        orderNumberLable.textColor = COLOR_HEX(0x121212);
        orderNumberLable.font = [UIFont systemFontOfSize:14.0f];
        [self.contentView addSubview:orderNumberLable];
        [orderNumberLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(12));
            make.top.equalTo(self.contentView.mas_top).offset(scaleTopAndBottom(13));
            make.right.equalTo(_statusBtn.mas_left).offset(-10);
            make.height.mas_equalTo(scaleTopAndBottom(13));
        }];
        UIView *lineView = [[UIView alloc] init];
        lineView.backgroundColor = COLOR_HEX(0xE8E8E8);
        [self.contentView addSubview:lineView];
        [lineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView);
            make.height.mas_equalTo(scaleTopAndBottom(0.5));
            make.top.equalTo(orderNumberLable.mas_bottom).offset(scaleTopAndBottom(13));
        }];
        UIImageView *pictureImageView = [[UIImageView alloc] init];
        [self.contentView addSubview:pictureImageView];
        [pictureImageView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(12));
            make.top.equalTo(lineView.mas_bottom).offset(scaleTopAndBottom(12));
            make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(87), scaleTopAndBottom(72)));
        }];
        UILabel *nameLable = [[UILabel alloc] init];
        nameLable.text = @"五彩玛丽颜料color";
        nameLable.textColor = COLOR_HEX(0x121212);
        nameLable.font = [UIFont systemFontOfSize:14.0f];
        [self.contentView addSubview:nameLable];
        [nameLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(pictureImageView.mas_right).offset(scaleLeftAndRight(10));
            make.top.equalTo(lineView.mas_bottom).offset(scaleTopAndBottom(14));
            make.right.equalTo(self.contentView.mas_right).offset(-10);
            make.height.mas_equalTo(scaleTopAndBottom(15));
        }];
        UILabel *choosePriceLable = [[UILabel alloc] init];
        choosePriceLable.text = @"选择商品的价格";
        choosePriceLable.textColor = COLOR_HEX(0xABABAB);
        choosePriceLable.font = [UIFont systemFontOfSize:12.0f];
        [self.contentView addSubview:choosePriceLable];
        [choosePriceLable mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.equalTo(pictureImageView.mas_right).offset(scaleLeftAndRight(10));
            make.top.equalTo(nameLable.mas_bottom).offset(scaleTopAndBottom(10));
            make.right.equalTo(self.contentView.mas_right).offset(-10);
            make.height.mas_equalTo(scaleTopAndBottom(15));
        }];
        UIView *bottomlineView = [[UIView alloc] init];
        bottomlineView.backgroundColor = COLOR_HEX(0xE8E8E8);
        [self.contentView addSubview:bottomlineView];
        [bottomlineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView);
            make.height.mas_equalTo(scaleTopAndBottom(0.5));
            make.top.equalTo(pictureImageView.mas_bottom).offset(scaleTopAndBottom(13));
        }];
        UILabel *prodecutPriceLabel = [[UILabel alloc] init];
        [self.contentView addSubview:prodecutPriceLabel];
        prodecutPriceLabel.text = @"共一件商品 实付款￥45";
        [prodecutPriceLabel mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(bottomlineView.mas_bottom).offset(scaleTopAndBottom(10));
            make.left.equalTo(self.contentView.mas_left).offset(scaleLeftAndRight(12));
            make.height.mas_equalTo(scaleTopAndBottom(12.5));
            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-12));
        }];
        UIView *bbottomlineView = [[UIView alloc] init];
        bbottomlineView.backgroundColor = COLOR_HEX(0xE8E8E8);
        [self.contentView addSubview:bbottomlineView];
        [bbottomlineView mas_makeConstraints:^(MASConstraintMaker *make) {
            make.left.right.equalTo(self.contentView);
            make.height.mas_equalTo(scaleTopAndBottom(0.5));
            make.top.equalTo(prodecutPriceLabel.mas_bottom).offset(scaleTopAndBottom(13));
        }];
        _deleBtn = [UIButton buttonWithType:UIButtonTypeCustom];
        _deleBtn.layer.borderColor = [UIColor blackColor].CGColor;
        _deleBtn.layer.borderWidth = 1.0f;
        [self.contentView addSubview:_deleBtn];
        [_deleBtn setTitle:@"删除订单" forState:UIControlStateNormal];
        _deleBtn.titleLabel.adjustsFontSizeToFitWidth = YES;
        [_deleBtn setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
        [_deleBtn mas_makeConstraints:^(MASConstraintMaker *make) {
            make.top.equalTo(bbottomlineView.mas_bottom).offset(scaleTopAndBottom(19));
            make.right.equalTo(self.contentView.mas_right).offset(scaleLeftAndRight(-12));
            make.size.mas_equalTo(CGSizeMake(scaleLeftAndRight(67), scaleTopAndBottom(20)));
        }];
        pictureImageView.backgroundColor = [UIColor redColor];
    }
    return self;
}


- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
